<template>
  <div class="head-title">
    <van-nav-bar left-text="返回" :title = title  left-arrow fixed @click-left="onClickLeft" />

    <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
   
         <van-cell v-for="(item,index) in list" :key="index"  @click="DeleteFileInfo(index)">
            {{ item.id  + item.name}} {{长传/删除}}
         </van-cell>

    </van-list>
  </div>
</template>

<script>

export default {
  data() {
    return {
      list: [],
      loading: false,
      finished: false,
      title:'',
    };
  },
  methods: {

    //删除多个或一个文件信息
    DeleteFileInfo() {
      const ids = '子idid'
      this.$axios({
        method: "post",
        url: "/api/User/DeleteFileInfo",
        // params: {
        //   fileid: 0//???
        // }
        data:id
      })
        .then(res => {
          if (res.data.code === 0) {
            console.log(res.data.data);
            //  this.images = res.data.data;
            //  console.log(this.images);
            // this.$toast({
            //   duration: 800,
            //   message: "数据已删除"
            // });
          }
          if (res.data.code == 1) {
              this.$toast({
                duration: 800,
                message: res.data.message
              });
          }
        })
        .catch(err => {
          console.log(err);
        });
    },

    Upload() {
      const ids = '子idid'
      this.$axios({
        method: "post",
        url: "/api/User/Upload",
        data: param,
        headers: {
          "Content-Type": "multipart/form-data"
        }
      })
        .then(res => {
          if (res.data.code === 0) {
            console.log(res.data.data);
            //  this.images = res.data.data;
            //  console.log(this.images);
            this.$toast({
              duration: 800,
              message: "数据已删除"
            });
          }
          if (res.data.code == 1) {
              this.$toast({
                duration: 800,
                message: res.data.message
              });
          }
        })
        .catch(err => {
          console.log(err);
        });
    },    
    //返回
    onClickLeft() {
      this.$router.push("/home");
    },

  },
  //页面初始化钩子函数 created
  created() {
    this.GetFiles();
    this.title = this.$route.query.title;
    // this.isActive = 0;
    this.$emit("header", false);
    this.$emit("footer", false);
  },
  //页面初始化钩子函数 mounted
  mounted() {}
};
</script>
<style lang="less" scoped>

</style>

